package Easy;

public class Solution1128 {
    public static int numEquivDominoPairs(int[][] dominoes) {
        int count[] = new int[100];
        for(int i = 0 ; i < dominoes.length ; i++){
            // 保证第一个数比第二个数小就行了
            int ten ;
            if(dominoes[i][0] < dominoes[i][1]){
                ten = 10*dominoes[i][0]+dominoes[i][1];
            }else{
                ten = 10*dominoes[i][1]+dominoes[i][0];
            }

            count[ten]++;
        }
        int sum = 0;
        for (int i = 11 ; i < 100 ; i++){
            for(int j = 1 ; j < count[i] ; j++){
                sum+=j;
            }
        }
        return sum;
    }

    public static void main(String[] args) {
        numEquivDominoPairs(new int[][]{{1,2},{2,1}});
    }
}
